﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Irvin_Engine.HUD
{
    abstract public class HUDElement
    {
        public enum AlignedElement
        {
            LEFT,
            CENTERED,
            RIGHT
        }
        protected AlignedElement alignedElement = AlignedElement.LEFT;
        Rectangle m_oPosition = new Rectangle();
        public Rectangle Position
        {
            get { return m_oPosition; }
            set
            {
                m_oPosition = value;
                switch (alignedElement)
                {
                    case AlignedElement.LEFT:
                        PositionWithAlignment.X = Position.X - Position.Width;
                        PositionWithAlignment.Y = Position.Y;
                        break;
                    case AlignedElement.CENTERED:
                        PositionWithAlignment.X = Position.X - Position.Width / 2;
                        PositionWithAlignment.Y = Position.Y;
                        break;
                    case AlignedElement.RIGHT:
                        PositionWithAlignment = Position;
                        break;
                }
            }
        }
        public Rectangle PositionWithAlignment;

        public HUDElement()
        {
            alignedElement = AlignedElement.RIGHT;
        }

        public HUDElement(Rectangle _pos) : this(_pos, AlignedElement.RIGHT)
        {
            Position = _pos;
        }

        public HUDElement(Rectangle _pos, AlignedElement _alignedElement) : this()
        {
            Position = _pos;
            alignedElement = _alignedElement;
        }

        virtual public void Update(GameTime gameTime)
        {
            
        }

        virtual public void Draw(GameTime gameTime)
        {               
        }
    }
}
